79 extensible streamable registry remove closed dispatcher add builder registration#80
Merged
lxsaah merged 10 commits intoMar 16, 2026
Conversation
…tion - Updated aimdb-data-contracts dependency version to 0.1.0 in Cargo.toml. - Refactored WasmDb to use a new registration method for Streamable types, allowing runtime dispatch. - Introduced a new StreamableRegistry for managing schema types in the WebSocket connector. - Added support for registering Streamable types in the WebSocketConnectorBuilder. - Implemented new data contracts for humidity and GPS location, including simulation and observability features. - Enhanced temperature schema with versioning and migration support for backward compatibility. - Added tests for the new StreamableRegistry and its functionalities.
…ther station dependencies
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the Streamable type system extensible by replacing the closed visitor-based discovery mechanism with explicit .register::<T>()-style registration across connectors/adapters, while moving demo contract structs out of aimdb-data-contracts to keep it publishable as a traits-only crate.
Changes:
- Introduces an explicit registration API (
.register::<T>()) for WebSocket and WASM adapters and removes thefor_each_streamable+StreamableVisitorpattern. - Adds a type-erased
StreamableRegistryto the WebSocket connector and makes the WASMSchemaRegistrycloneable viaArc-wrapped closures. - Updates example crates and dependency versions (including Embassy) and adjusts the publish chain to include
aimdb-data-contractsv0.1.0.
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/weather-mesh-demo/weather-station-gamma/Cargo.toml | Enables weather-mesh-common simulation features and updates Embassy executor feature flag. |
| examples/weather-mesh-demo/weather-station-beta/Cargo.toml | Enables weather-mesh-common features needed for linking/migration/simulation. |
| examples/weather-mesh-demo/weather-station-alpha/Cargo.toml | Enables weather-mesh-common features needed for linking/migration. |
| examples/weather-mesh-demo/weather-mesh-common/src/lib.rs | Moves demo contract types to local contracts module and re-exports traits. |
| examples/weather-mesh-demo/weather-mesh-common/src/contracts/temperature.rs | Adds demo Temperature contract with migration + simulation + linkability behind features. |
| examples/weather-mesh-demo/weather-mesh-common/src/contracts/mod.rs | Aggregates and re-exports demo contract modules. |
| examples/weather-mesh-demo/weather-mesh-common/Cargo.toml | Adds feature-gated deps for link/sim/migrate in demo contracts crate. |
| examples/weather-mesh-demo/weather-hub/Cargo.toml | Enables weather-mesh-common linking/migration features for hub usage. |
| examples/embassy-mqtt-connector-demo/Cargo.toml | Updates Embassy executor feature flag to new naming. |
| examples/embassy-knx-connector-demo/Cargo.toml | Updates Embassy executor feature flag to new naming. |
| aimdb-websocket-connector/src/registry.rs | Adds new registry for type-erased Streamable dispatch and lookup + tests. |
| aimdb-websocket-connector/src/lib.rs | Exposes the registry module under the server feature. |
| aimdb-websocket-connector/src/builder.rs | Replaces closed discovery with explicit .register::<T>() registration and uses registry for known topics. |
| aimdb-websocket-connector/Cargo.toml | Adds versions to internal deps for crates.io compatibility. |
| aimdb-wasm-adapter/src/schema_registry.rs | Replaces visitor-built registry with explicit registration and makes entries cloneable via Arc. |
| aimdb-wasm-adapter/src/bindings.rs | Switches to SchemaRegistry::new() and adds Rust-only .register::<T>() API on WasmDb. |
| aimdb-wasm-adapter/Cargo.toml | Aligns aimdb-data-contracts version with the new v0.1.0. |
| aimdb-mqtt-connector/Cargo.toml | Bumps Embassy dependency versions (path-based) for embedded support. |
| aimdb-knx-connector/Cargo.toml | Bumps Embassy dependency versions (path-based) for embedded support. |
| aimdb-data-contracts/src/streamable.rs | Removes visitor/discovery API and updates docs/tests to reflect explicit registration model. |
| aimdb-data-contracts/src/observable.rs | Updates docs to avoid importing removed contracts module. |
| aimdb-data-contracts/src/migratable.rs | Updates docs to reference user-defined contract types and new naming. |
| aimdb-data-contracts/src/linkable.rs | Reworks tests to use local test-only structs (no built-in contracts). |
| aimdb-data-contracts/src/lib.rs | Makes crate a traits-focused surface (removes contracts module export) and updates docs. |
| aimdb-data-contracts/src/contracts/temperature.rs | Removes built-in Temperature contract implementation from the traits crate. |
| aimdb-data-contracts/src/contracts/mod.rs | Removes built-in contracts module surface. |
| aimdb-data-contracts/src/contracts/location.rs | Adjusts existing contract code (but contracts module is no longer exported). |
| aimdb-data-contracts/src/contracts/humidity.rs | Adjusts existing contract code (but contracts module is no longer exported). |
| aimdb-data-contracts/Cargo.toml | Sets crate version to v0.1.0, removes ts-rs feature, and adds versions to internal deps. |
| _external/mountain-mqtt | Updates submodule pointer. |
| _external/knx-pico | Updates submodule pointer. |
| _external/embassy | Updates submodule pointer. |
| Makefile | Inserts aimdb-data-contracts into publication order and updates progress counters. |
| Cargo.toml | Updates workspace-pinned Embassy dependency versions and executor feature flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… update WebSocketConnectorBuilder registration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
for_each_streamable()+StreamableVisitorpattern with.register::<T>()builder methods onWebSocketConnectorBuilderandWasmDb, allowing users to register their ownStreamabletypesTemperature,Humidity,GpsLocation) fromaimdb-data-contractsand move them toweather-mesh-commonexample code — the crate is now a pure traits crate at v0.1.0, publishable to crates.ioStreamableRegistry: Add type-erased dispatch registry inaimdb-websocket-connectorusing monomorphized closures (noBox<dyn Any>on the hot path)SchemaRegistryclosures changed fromBoxtoArc, enabling cheap cloning betweenWasmDbandWsBridgeaimdb-data-contractsadded as position 5/18 inmake publish; all path-only deps now include version constraints for crates.io compatibilityarch-cortex-m→platform-cortex-mBreaking changes
for_each_streamable()andStreamableVisitorremoved fromaimdb-data-contractscontractsmodule removed fromaimdb-data-contracts— import types from your own crateSchemaRegistry::build()→SchemaRegistry::new()+.register::<T>()calls.register::<T>()required